package offer;

import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/**
 * 描述:剑指 Offer 50. 第一个只出现一次的字符
 *
 * @author Madison You
 * @created 0:39
 */
public class Easy_50_FirstUniqChar {
    public char firstUniqChar(String s) {
        if (s.equals("")) return ' ';
        int[] ints = new int[26];
        for (int i = 0; i < s.length(); i++) {
            ints[s.charAt(i) - 'a']++;
        }
        for (int i = 0; i < s.length(); i++) {
            if (ints[s.charAt(i) - 'a'] == 1) return s.charAt(i);
        }
        return ' ';
    }
}
